package com.vae.mall.goods.feign;

import com.vae.cart.model.Cart;
import com.vae.mall.common.response.RespResult;
import com.vae.mall.goods.api.aggregate.AditemSku;
import com.vae.mall.goods.api.entity.Sku;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * SkuFeign 远程调用
 * @author vae
 * @since 1.0
 */

@FeignClient(contextId = "skuFeign",value = "goods-service")
public interface SkuFeign {

    /**
     *  查询指定分类下 推广产品 列表
     * @return
     */
    @RequestMapping("/sku/aditems/type")
    public RespResult<List<AditemSku>> typeitems(@RequestParam(value = "id") Integer id);

    /****
     * 删除指定分类下的推广产品列表
     */
    @DeleteMapping(value = "/sku/delitems/type")
    public RespResult deleteTypeItems(@RequestParam(value = "id") Integer id);


    /**
     * 修改指定分类下的推广产品列表
     * @param id
     * @return
     */
    @PutMapping(value = "/sku/updateitems/type")
    public RespResult<List<AditemSku>>  updateTypeItems(@RequestParam(value = "id") Integer id);

    /****
     * 根据skuId获取Sku
     */
    @GetMapping(value = "/sku/{skuId}")
    public RespResult<Sku> one(@PathVariable(value = "skuId") String skuId);

    /***
     * 库存递减
     * @param carts
     * @return
     */
    @PostMapping(value = "/sku/dcount")
    RespResult decount(List<Cart> carts);


}
